﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZLCMS.Business.DwzFrame;
using DotNet.Common.Command;
using ZLCMS.Commands.User.Commands.RightGroup;

namespace ZLCMS.Web.SystemManage.Basics.RightConfig.Group
{
    public partial class GroupList : System.Web.UI.Page
    {
        protected FrameHelper _framePage;

        protected void Page_Load(object sender, EventArgs e)
        {
            _framePage = new FrameHelper(this);

            LoadGroupListParameter param = new LoadGroupListParameter();

            param.PageSize = _framePage.IsAjaxPagerPostBack ? _framePage.PageSize : 20;
            param.PageIndex = _framePage.IsAjaxPagerPostBack ? _framePage.PageIndex : 1;
            param.NameValueFilter = Request["name"];
            param.CodeValueFilter = Request["code"];
            ICommandResult<LoadGroupListResult> result = new LoadGroupListCommand().Execute(param);
            if (!result.Error)
            {
                _framePage.RecordCount = result.TotalCount;
                grid.DataSource = result.Result.List;
                grid.DataBind();
            }
            else
            {
                _framePage.Alert(new ReturnCode() { statusCode = 300, message = result.ErrorMsg });
            }
        }
    }
}
